package datamodel.entities;

import java.util.HashMap;

import datamodel.world.Material;
import datamodel.world.Realm;

/**
 * responsible for modeling the attributes and behavior of items in the game
 * @author Peter
 *
 */
public abstract class Item extends Entity {
	
	/**
	 * represents the material this item is constructed out of
	 */
	Material material;
	
	/**
	 * creates an item with default realm affinities and a specified material
	 * @param mat is the material this item is constructed out of
	 */
	Item(Material mat){
		super();
		this.material = mat;
		// makes sure that all items have at least rudimentary Artifice affinity
		this.realmAffinity.put(Realm.ARTIFICE, 1);
	}
	
	/**
	 * creates an item with specified realm affinities and a specified material
	 * @param mat is the material this item is constructed out of
	 * @param rA is the map of realms and affinity values
	 */
	Item(Material mat, HashMap<Realm, Integer> rA){
		super(rA);
		this.material = mat;
		if(this.realmAffinity.get(Realm.ARTIFICE) == 0){
			// makes sure that all items have at least rudimentary Artifice affinity
			this.realmAffinity.put(Realm.ARTIFICE, 1);
		}
	}
	
	/**
	 * retrieves the material information of this Item
	 * @return the Material from which this Item is constructed
	 */
	public Material getMaterial(){
		return this.material;
	}

}
